﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:ctrl="clr-namespace:MediaOwl.Common.ControlTemplates;assembly=MediaOwl.Common"
             x:Class="MediaOwl.Netflix.Views.MovieGenreHomeView"
             mc:Ignorable="d"
             d:DesignHeight="440"
             d:DesignWidth="638">
    <UserControl.Resources>

        <DataTemplate x:Key="GenreItemTemplate">
            <toolkit:DockPanel Margin="5">
                <TextBlock TextWrapping="Wrap"
                           Text="{Binding Name}"
                           Style="{StaticResource Heading4}"
                           Foreground="{StaticResource ControlForeground}"
                           toolkit:DockPanel.Dock="Top" />
            </toolkit:DockPanel>
        </DataTemplate>
    </UserControl.Resources>
    <ctrl:WorkitemControl BusyContext="{Binding CurrentBusyViewModel}"
                          DialogContext="{Binding ActiveDialog}">
        <toolkit:DockPanel Margin="5">
            <toolkit:DockPanel LastChildFill="False"
                               toolkit:DockPanel.Dock="Top"
                               Margin="0,0,0,5">
                <TextBlock x:Name="DisplayName"
                           TextWrapping="Wrap"
                           toolkit:DockPanel.Dock="Top"
                           Style="{StaticResource Heading2}"
                           Margin="0,0,0,10" />
                <TextBlock x:Name="SearchResultText"
                           Foreground="{StaticResource ControlForeground}"
                           MinHeight="20"
                           Margin="0,2,0,0"
                           toolkit:DockPanel.Dock="Bottom" />
                <TextBox x:Name="SearchText"
                         TextWrapping="Wrap"
                         Margin="0,0,10,0"
                         MinWidth="150"
                         VerticalAlignment="Top">
                    <i:Interaction.Triggers>
                        <ei:KeyTrigger Key="Enter">
                            <cal:ActionMessage MethodName="SearchShortCut" />
                        </ei:KeyTrigger>
                    </i:Interaction.Triggers>
                </TextBox>
                <Button x:Name="SearchItems"
                        Content="Search"
                        Margin="0,0,10,0"
                        VerticalAlignment="Top" />
                <StackPanel Orientation="Horizontal"
                            HorizontalAlignment="Right"
                            toolkit:DockPanel.Dock="Right">
                    <Button x:Name="Previous"
                            Content="Previous"
                            d:LayoutOverrides="Height" />
                    <toolkit:NumericUpDown x:Name="ItemsPerPage"
                                           Increment="10"
                                           Minimum="1"
                                           Margin="5,0"
                                           Width="60" />
                    <Button x:Name="Next"
                            Content="Next"
                            d:LayoutOverrides="Height"
                            Margin="0" />
                </StackPanel>
            </toolkit:DockPanel>

            <ListBox x:Name="Genres"
                     ItemTemplate="{StaticResource GenreItemTemplate}"
                     d:LayoutOverrides="Height"
                     Background="Transparent"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                     SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                     ItemsPanel="{StaticResource WrappingItemsPanelTemplate}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <cal:ActionMessage MethodName="Open" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </ListBox>

        </toolkit:DockPanel>
    </ctrl:WorkitemControl>
</UserControl>
